<template>
  <div class="upload-container">
    <el-button :style="{background:color,borderColor:color}" icon="el-icon-upload" size="mini" type="primary" @click=" dialogVisible=true">
      上传图片
    </el-button>
    <el-dialog title="上传图片" :visible.sync="dialogVisible" append-to-body>
      <multi-upload v-model="fileListArr" />
      <template #footer>
        <span class="dialog-footer">
          <el-button @click="dialogVisible = false">取 消</el-button>
          <el-button type="primary" @click="handleSubmit">确 定</el-button>
        </span>
      </template>
    </el-dialog>
  </div>
</template>

<script>
// import { getToken } from 'api/qiniu'

import MultiUpload from '@/components/Upload/MultiUpload'
export default {
  name: 'EditorSlideUploadMulti',
  components: { MultiUpload },
  props: {
    color: {
      type: String,
      default: '#1890ff'
    }
  },
  data() {
    return {
      dialogVisible: false,
      listObj: {},
      fileListArr: []
    }
  },
  methods: {
    handleSubmit() {
      const arr = []
      for (let i = 0, len = this.fileListArr.length; i < len; i++) {
        arr.push({ url: this.fileListArr[i] })
      }
      console.log(arr)
      this.$emit('successCBK', arr)
      this.fileListArr = []
      this.dialogVisible = false
    }
  }
}
</script>

<style lang="scss" scoped>

</style>
